<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "guide_pay_log".
 *
 * @property string $id
 * @property string $gid
 * @property string $langcode
 * @property string $price
 * @property string $uid openid
 * @property string $create_at
 */
class GuidePayLog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'guide_pay_log';
    }

    public function getGuide()
    {
        return GuideFieldData::findOne(['gid'=>$this->gid, 'langcode'=>$this->langcode]);
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['gid', 'langcode'], 'required'],
            [['gid'], 'integer'],
            [['price'], 'number'],
            [['create_at'], 'safe'],
            [['langcode'], 'string', 'max' => 12],
            [['uid'], 'string', 'max' => 40],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'gid' => Yii::t('app', 'Gid'),
            'langcode' => Yii::t('app', 'Langcode'),
            'price' => Yii::t('app', 'Price'),
            'uid' => Yii::t('app', 'Uid'),
            'create_at' => Yii::t('app', 'Create At'),
        ];
    }
}
